#pragma once

#include "LvModel.h"

#include <memory>

struct Transform2dComponent
{
	glm::vec2 translation{};
	glm::vec2 scale{ 1.0f, 1.0f };
	float rotation{ 0.0f };

	glm::mat2 mat2()
	{
		const float s = glm::sin(rotation);
		const float c = glm::cos(rotation);
		glm::mat2 rotMatrix{ {c, s}, {-s, c} };
		glm::mat2 scaleMat{ {scale.x, 0.0f}, {0.0, scale.y} };
		return rotMatrix * scaleMat;
	}
};


class LvGameObject
{
public:
	using id_t = unsigned int;

	static LvGameObject createGameObject()
	{
		static id_t currentId = 0;
		return LvGameObject(currentId);
	}

	LvGameObject(const LvGameObject&) = delete;
	LvGameObject& operator=(const LvGameObject&) = delete;
	LvGameObject(LvGameObject&&) = default;
	LvGameObject& operator=(LvGameObject&&) = default;
	
	id_t getId()
	{
		return id;
	}

	std::shared_ptr<LvModel> model{};
	glm::vec3 color{};
	Transform2dComponent trnsform2d{};

private:
	LvGameObject(id_t objId) : id{ objId } {}

	id_t id;

};

